{
LANG : PASCAL
PROB : contact
}
program CONTACT;
const
  fi = 'contact.in';
  fo = 'contact.out';
  bit : array[1..13] of integer =
  (1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096);
  maxc = 200000;
type
  tt = record
         f : longint;
         name : string[12];
       end;
var
  p : array[0..maxc] of byte;
  v : array[0..4096] of longint;
  c : array[1..10000] of tt;
  a, b, n, m, l : longint;

procedure inp;
var
  kt : char;
begin
  readln(a, b, n);
  m := 0;
  fillchar(p, sizeof(p), 2);
  p[0] := 0;
  while not eoln do
  begin
    inc(m);
    read(kt);
    p[m] := ord(kt) - 48;
    if m mod 80 = 0 then readln;
  end;
end;

procedure process;
var
  leng, i, j : longint;
  s : integer;
begin
  l := 0;
  for leng := a to b do
  begin
    fillchar(v, sizeof(v), 0);
    s := 0;
    for j := 1 to leng-1 do s := s*2 + p[j];
    for j := leng to m do
    begin
      if p[j-leng] = 1 then s := s - bit[leng];
      s := s*2;
      if p[j] = 1 then inc(s);
      inc(v[s]);
    end;
    for j := 0 to bit[leng+1]-1 do
      if v[j] > 0 then
      begin
        inc(l);
        with c[l] do
        begin
          f := v[j];
          name := '';
          for i := 1 to leng do
            if j shr (i-1) and 1 = 1 then name := '1' + name
            else name := '0' + name;
        end;
      end;
  end;
end;

function nhohon(u, v : tt) : boolean;
begin
  if u.f > v.f then
  begin
    nhohon := false;
    exit;
  end else
  if u.f < v.f then
  begin
    nhohon := true;
    exit;
  end;
  if length(u.name) < length(v.name) then
  begin
    nhohon := false;
    exit;
  end else
  if length(u.name) > length(v.name) then
  begin
    nhohon := true;
    exit;
  end;
  nhohon := u.name > v.name;
end;

procedure swap(i, j : longint);
var
  temp : tt;
begin
  temp := c[i];
  c[i] := c[j];
  c[j] := temp;
end;

procedure sort(l, r : longint);
var
  i, j : longint;
  k : tt;
begin
  if l >= r then exit;
  i := l;
  j := r;
  k := c[l + random(r-l+1)];
  repeat
    while nhohon(k, c[i]) do inc(i);
    while nhohon(c[j], k) do dec(j);
    if i <= j then
    begin
      swap(i, j);
      inc(i); dec(j);
    end;
  until i > j;
  sort(i, r); sort(l, j);
end;

procedure out;
var
  i, s, t, count : integer;
begin
  sort(1, l);
  t := 0;
  for i := 1 to n do
  begin
    s := t+1;
    t := s;
    writeln(c[s].f);
    write(c[s].name);
    count := 1;
    while (t < l) and (c[t+1].f = c[s].f) do
    begin
      if count mod 6 = 0 then writeln;
      inc(count);
      inc(t);
      if count mod 6 = 1 then write(c[t].name)
      else write(' ', c[t].name);
    end;
    writeln;
    if t = l then break;
  end;
end;

begin
  assign(input, fi); reset(input);
  assign(output, fo); rewrite(output);
  inp;
  process;
  out;
  close(output);
  close(input);
end.
